package com.brianxia.onlineproblemsolution.controller;

import java.util.*;

/**
 * @author brianxia
 * @version 1.0
 * @date 2021/11/12 14:55
 */
public class Demo {
    public static void main(String[] args) {
        Integer A[] = {1,2,3,4};
        Integer B[] = {1,2,3,4};

        ArrayList<Integer> list = new ArrayList<>();
        Set<Integer> bSet = new HashSet<>(Arrays.asList(B));
        for (Integer a : A) {
            if(bSet.contains(a)){
                list.add(a);
            }
        }

    }
}
